home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / man / cat.3 / libpnm.3 < prev    next >
Text File  |  1995-07-25  |  8KB  |  199 lines

  1.  
  2.  
  3.  
  4.      lllliiiibbbbppppnnnnmmmm((((3333))))                 UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV                 lllliiiibbbbppppnnnnmmmm((((3333))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.           libpnm - functions to support portable anymap programs
  10.  
  11.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.           #include <pnm.h>
  13.           cc ... libpnm.a libppm.a libpgm.a libpbm.a
  14.  
  15.  
  16.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  17.         TTTTYYYYPPPPEEEESSSS AAAANNNNDDDD CCCCOOOONNNNSSSSTTTTAAAANNNNTTTTSSSS
  18.           typedef ... xel;
  19.           typedef ... xelval;
  20.           #define PNM_MAXMAXVAL ...
  21.           extern xelval pnm_pbmmaxval;
  22.  
  23.           Each xxxxeeeellll contains three xxxxeeeellllvvvvaaaalllls, each of which should
  24.           contain only the values between 0000 and PPPPNNNNMMMM____MMMMAAAAXXXXMMMMAAAAXXXXVVVVAAAALLLL.
  25.           ppppnnnnmmmm____ppppbbbbmmmmmmmmaaaaxxxxvvvvaaaallll is the maxval used when a PNM program reads a
  26.           PBM file.  Normally it is 1; however, for some programs, a
  27.           larger value gives better results.
  28.  
  29.         XXXXEEEELLLL MMMMAAAANNNNIIIIPPPPUUUULLLLAAAATTTTIIIIOOOONNNNSSSS
  30.           xelval PNM_GET1( xel x )
  31.  
  32.           This macro extracts a single value from an xel, when you
  33.           know it's from a PBM or PGM file.  When it's from a PPM
  34.           file, use PPPPPPPPMMMM____GGGGEEEETTTTRRRR(((()))), PPPPPPPPMMMM____GGGGEEEETTTTGGGG(((()))), and PPPPPPPPMMMM____GGGGEEEETTTTBBBB(((()))).
  35.  
  36.           void PNM_ASSIGN1( xel x, xelval v )
  37.  
  38.           This macro assigns a single value to an xel, when you know
  39.           it's from a PBM or PGM file.  When it's from a PPM file, use
  40.           PPPPPPPPMMMM____AAAASSSSSSSSIIIIGGGGNNNN(((()))).
  41.  
  42.           int PNM_EQUAL( xel x, xel y )
  43.  
  44.           This macro checks two xels for equality.
  45.  
  46.           int PNM_FORMAT_TYPE( int format )
  47.  
  48.           For distinguishing different file types.
  49.  
  50.         IIIINNNNIIIITTTTIIIIAAAALLLLIIIIZZZZAAAATTTTIIIIOOOONNNN
  51.           void pnm_init( int* argcP, char* argv[] )
  52.  
  53.           All PNM programs must call this routine.
  54.  
  55.         MMMMEEEEMMMMOOOORRRRYYYY MMMMAAAANNNNAAAAGGGGEEEEMMMMEEEENNNNTTTT
  56.           xel** pnm_allocarray( int cols, int rows )
  57.  
  58.           Allocate an array of xels.
  59.  
  60.  
  61.  
  62.  
  63.      Page 1                                          (printed 7/10/95)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      lllliiiibbbbppppnnnnmmmm((((3333))))                 UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV                 lllliiiibbbbppppnnnnmmmm((((3333))))
  71.  
  72.  
  73.  
  74.           xel* pnm_allocrow( int cols )
  75.  
  76.           Allocate a row of the given number of xels.
  77.  
  78.           void pnm_freearray( xel** xels, int rows )
  79.  
  80.           Free the array allocated with ppppnnnnmmmm____aaaallllllllooooccccaaaarrrrrrrraaaayyyy(((()))) containing
  81.           the given number of rows.
  82.  
  83.           void pnm_freerow( xel* xelrow )
  84.  
  85.           Free a row of xels.
  86.  
  87.         RRRREEEEAAAADDDDIIIINNNNGGGG FFFFIIIILLLLEEEESSSS
  88.           void pnm_readpnminit( FILE* fp, int* colsP, int* rowsP, xelval* maxvalP, int* formatP )
  89.  
  90.           Read the header from a PNM file, filling in the rows, cols,
  91.           maxval and format variables.
  92.  
  93.           void pnm_readpnmrow( FILE* fp, xel* xelrow, int cols, xelval maxval, int format )
  94.  
  95.           Read a row of xels into the xelrow array.  Format, cols, and
  96.           maxval were filled in by ppppnnnnmmmm____rrrreeeeaaaaddddppppnnnnmmmmiiiinnnniiiitttt(((()))).
  97.  
  98.           xel** pnm_readpnm( FILE* fp, int* colsP, int* rowsP, xelval* maxvalP, int* formatP )
  99.  
  100.           Read an entire anymap file into memory, returning the
  101.           allocated array and filling in the rows, cols, maxval, and
  102.           format variables.  This function combines ppppnnnnmmmm____rrrreeeeaaaaddddppppnnnnmmmmiiiinnnniiiitttt(((()))),
  103.           ppppnnnnmmmm____aaaallllllllooooccccaaaarrrrrrrraaaayyyy(((()))) and ppppnnnnmmmm____rrrreeeeaaaaddddppppnnnnmmmmrrrroooowwww(((()))).  Unlike the
  104.           equivalent functions in PBM, PGM, and PPM, it returns the
  105.           format so you can tell what type the file is.
  106.  
  107.         WWWWRRRRIIIITTTTIIIINNNNGGGG FFFFIIIILLLLEEEESSSS
  108.           void pnm_writepnminit( FILE* fp, int cols, int rows, xelval maxval, int format, int forceplain )
  109.  
  110.           Write the header for a portable anymap file.  Unlike the
  111.           equivalent functions in PBM, PGM, and PPM, you have to
  112.           specify the output type.  The forceplain flag forces a
  113.           plain-format file to be written, as opposed to a raw-format
  114.           one.
  115.  
  116.           void pnm_writepnmrow( FILE* fp, xel* xelrow, int cols, xelval maxval, int format, int forceplain )
  117.  
  118.           Write a row from a portable anymap.
  119.  
  120.           void pnm_writepnm( FILE* fp, xel** xels, int cols, int rows, xelval maxval, int format, int forceplain )
  121.  
  122.           Write the header and all data for a portable anymap.  This
  123.           function combines ppppnnnnmmmm____wwwwrrrriiiitttteeeeppppnnnnmmmmiiiinnnniiiitttt(((()))) and ppppnnnnmmmm____wwwwrrrriiiitttteeeeppppnnnnmmmmrrrroooowwww(((()))).
  124.  
  125.         FFFFOOOORRRRMMMMAAAATTTT PPPPRRRROOOOMMMMOOOOTTTTIIIIOOOONNNN
  126.  
  127.  
  128.  
  129.      PPPPaaaaggggeeee 2222                                          ((((pppprrrriiiinnnntttteeeedddd 7777////11110000////99995555))))
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      lllliiiibbbbppppnnnnmmmm((((3333))))                 UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV                 lllliiiibbbbppppnnnnmmmm((((3333))))
  137.  
  138.  
  139.  
  140.           void pnm_promoteformatrow( xel* xelrow, int cols, xelval maxval, int format, xelval newmaxval, int newformat )
  141.  
  142.           Promote a row of xels from one maxval and format to a new
  143.           set.  Used when combining multiple anymaps of different
  144.           types - just take the max of the maxvals and the max of the
  145.           formats, and promote them all to that.
  146.  
  147.           void pnm_promoteformat( xel** xels, int cols, int rows, xelval maxval, int format, xelval newmaxval, int newformat )
  148.  
  149.           Promote an entire anymap.
  150.  
  151.         XXXXEEEELLLL MMMMAAAANNNNIIIIPPPPUUUULLLLAAAATTTTIIIIOOOONNNN
  152.           xel pnm_whitexel( xelval maxval, int format )
  153.           xel pnm_blackxel( xelval maxval, int format )
  154.  
  155.           Return a white or black xel for the given maxval and format.
  156.  
  157.           void pnm_invertxel( xel* x, xelval maxval, int format )
  158.  
  159.           Invert an xel.
  160.  
  161.           xel pnm_backgroundxelrow( xel* xelrow, int cols, xelval maxval, int format )
  162.  
  163.           Figure out an appropriate background xel based on this row.
  164.  
  165.           xel pnm_backgroundxel( xel** xels, int cols, int rows, xelval maxval, int format )
  166.  
  167.           Figure out a background xel based on an entire anymap.  This
  168.           can do a slightly better job than ppppnnnnmmmm____bbbbaaaacccckkkkggggrrrroooouuuunnnnddddxxxxeeeellllrrrroooowwww(((()))).
  169.  
  170.      SSSSEEEEEEEE AAAALLLLSSSSOOOO
  171.           pbm(3), pgm(3), ppm(3)
  172.  
  173.      AAAAUUUUTTTTHHHHOOOORRRR
  174.           Copyright (C) 1989, 1991 by Tony Hansen and Jef Poskanzer.
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.      Page 3                                          (printed 7/10/95)
  196.  
  197.  
  198.  
  199.